<template>
  <div class="a">
    <div class="b">
      <img  class="b-1" src="/static/1.png">
      <div class="b-2">
        <span></span>
      </div>
    </div>

    <div class="c">
        <div class="c-1">
            <span>短信验证码已经发送到188****8766</span>
        </div>
    </div>

    <div class="d">
        <div class="d-1">
            <el-input v-model="input" placeholder="请输入验证码"></el-input>
        </div>
        <div class="d-2">
            <span v-show="show" @click="getCode">获取验证码</span>
            <span v-show="!show" class="count">{{count}} s后重新获取</span>
        </div>
    </div>

    <div class="e">
        <div class="e-1">
            <span>提交</span>
        </div>
    </div>
  </div>
</template>

<script type="text/ecmascript-6">
export default {
  data () {
    return {
      show: true,

      count: '',

      timer: null
    }
  },

  methods: {
    getCode () {
      const TIME_COUNT = 60

      if (!this.timer) {
        this.count = TIME_COUNT

        this.show = false

        this.timer = setInterval(() => {
          if (this.count > 0 && this.count <= TIME_COUNT) {
            this.count--
          } else {
            this.show = true

            clearInterval(this.timer)

            this.timer = null
          }
        }, 1000)
      }
    }
  }
}
</script>

<style>
    .a{
    width: 468px;
    height: 792px;
  }
  .b{
    width: 468px;
    height: 54px;
    border-bottom: 1px solid rgb(207, 207, 207);
  }
  .b-1{
    width: 26px;
    height: 27px;
    float: left;
    margin-top: 12px;
    margin-left:10px;
  }
  .b-2{
    width: 100px;
    height: 27px;
    float:right;
    margin-right: 200px;
    margin-top: 12px;
    font-size: 20px;
  }

  .c{
    width: 468px;
    height: 54px;
    margin-top: 50px;
  }
  .c-1{
      font-size: 25px;
      color:rgb(48, 51, 51);
      margin-left: 50px;
      margin-right: 50px;
  }
  .d{
      width: 468px;
      height: 54px;
      margin-top: 50px;
  }
  .d-1{
      width: 250px;
      height: 54px;
      margin-left: 15px;
      margin-right: 50px;
      float: left;
  }
  .d-2{
      margin-top: 10px;
      float:right;
  }

  .e{
      width: 370px;
      height: 54px;
      margin-top: 25px;
      background-color: rgb(128, 39, 212);
      border-radius: 300px;
      margin-left: 50px;
  }
  .e-1{
      font-size: 20px;
      color:white;
      width: 100px;
      float:left;
      margin-left: 140px;
      margin-top: 15px;
  }
</style>
